﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CharacterCreation.Data.Annotations;

namespace CharacterCreation.Data {
    public class TableDefinition {
        public Type Model { get; set; }
        public bool Exists { get; set; }
        public bool IsUpToDate { get; set; }
        public TableAttribute TableAttribute { get; set; }
        public IEnumerable<ColumnAttribute> ColumnAttributes { get; set; }
        public IEnumerable<ColumnDefinition> ColumnDefinitions { get; set; }

        public ColumnDefinition IdentityColumn
        {
            get
            {
                return ColumnDefinitions.FirstOrDefault(cd => cd.IsIdentityColumn);
            }
        }
    }
}
